package com.example.demo.strategy;

import com.google.common.collect.Maps;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @author cici
 */
@Component
public class BizMethod implements BizMethodService {
    private Map<Integer, MethodService> couponCheckerMap = Maps.newConcurrentMap();
    public BizMethod(List<MethodService> methodServiceList){
        for(MethodService methodService : methodServiceList){
            couponCheckerMap.put(methodService.getType(),methodService);
        }
    }


    @Override
    public void doBizMethod(Integer type) {
        MethodService methodService = couponCheckerMap.get(type);
        methodService.method();
    }
}
